package com.gsafety.wellsfort.domain.form;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class Tree {
    private Integer id;

    private String title;

    private Integer lev;

    private String icon;

    private Boolean expand = true;

    private Boolean loading = true;

    private Boolean selected = false;

    private Boolean disabled = false;

    private String viewCode;

    private List<Tree> children;

    public Tree() {

    }

    public Tree(Integer id, String title, Integer lev, String icon, String viewCode, Boolean selected) {
        this.id = id;
        this.title = title;
        this.lev = lev;
        this.icon = icon;
        this.viewCode = viewCode;
        this.selected = selected;
    }

    public void addChildren(Tree tree){
        if(this.children == null){
            this.children = new ArrayList<>();
        }
        this.children.add(tree);
    }
}
